package com.gxa.community.admin.config;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

/**
 * @author bill
 * @date 2022/6/24 15:12
 */
public class MPGenerator {
    public static void main(String[] args) {
        String url = "jdbc:mysql://db.iit.la:3306/axlab_shopping?characterEncoding=UTF8&serverTimezone=Asia/Shanghai";
        String username = "root";
        String password = "Xyj123456";
        FastAutoGenerator.create(url, username, password)
                .globalConfig(builder -> {
                    builder.author("gxa") // 设置作者
                            .enableSwagger() // 开启 swagger 模式(自动生成swagger注解)
                            .fileOverride() // 覆盖已生成文件
                            .outputDir("E:\\mp_generator"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.juran") // 设置父包名
                            .moduleName("shopping") // 设置父包模块名
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "E:\\mp_generator"));
                })
                .strategyConfig(builder -> {
//
                    builder.addInclude("user_withdrawal_record")
                           /* .addInclude("admin")
                            .addInclude("admin")
                            .addInclude("admin_role")
                            .addInclude("after_sales")
                            .addInclude("bill")
                            .addInclude("bill_commission")
                            .addInclude("bill_withdraw")
                            .addInclude("driver_info")
                            .addInclude("goods_brand")
                            .addInclude("goods_class")
                            .addInclude("goods_info")
                            .addInclude("goods_log")
                            .addInclude("goods_tag")
                            .addInclude("hot_word")
                            .addInclude("menu")
                            .addInclude("operate_full")
                            .addInclude("operate_full_goods_rel")
                            .addInclude("operate_full_record")
                            .addInclude("operate_kill_spell")
                            .addInclude("operate_kill_spell_goods")
                            .addInclude("operate_ticket")
                            .addInclude("operate_ticket_code")
                            .addInclude("operate_ticket_goods_rel")*/
//                            .addInclude("operation_log")
                           /* .addInclude("order_goods_info")
                            .addInclude("order_goods_rel")
                            .addInclude("order_info")
                            .addInclude("role_menu")
                            .addInclude("system_info")
                            .addInclude("topic_goods")
                            .addInclude("topic_info")
                            .addInclude("user_agent_application")
                            .addInclude("user_info")
                            .addInclude("user_shipping_address")
                            .addInclude("user_shipping_rel")
                            .addInclude("user_tags")
                            .addInclude("user_tags_rel")
                            .addInclude("waybill_info")*/
                            .addTablePrefix("tb_","sys_","v_"); // 设置过滤表前缀
                })
// .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .execute();
    }

}
